//
//  UtilsTests.cpp
//  FuseSQLite
//
//  Created by Admin on 6/8/14.
//  Copyright (c) 2014 Admin. All rights reserved.
//

#include "Utils.h"

#include <gtest/gtest.h>

using namespace Utils;

TEST(splitPathIntoComponents, split)
{
    std::vector<std::string> components;
    splitPathIntoComponents("/", &components);
    
    std::vector<std::string> componentsEtalon = {"/"};
    EXPECT_EQ(components, componentsEtalon);

    splitPathIntoComponents("test", &components);
    
    componentsEtalon = {"test"};
    EXPECT_EQ(components, componentsEtalon);
    
    splitPathIntoComponents("/test", &components);
    
    componentsEtalon = {"/", "test"};
    EXPECT_EQ(components, componentsEtalon);
    
    splitPathIntoComponents("/test/test1", &components);
    
    componentsEtalon = {"/", "test", "test1"};
    EXPECT_EQ(components, componentsEtalon);
    
    splitPathIntoComponents("/test/test1/test/test2/test3", &components);
    
    componentsEtalon = {"/", "test", "test1", "test", "test2", "test3"};
    EXPECT_EQ(components, componentsEtalon);

    splitPathIntoComponents("//test//test", &components);
    
    componentsEtalon = {"/", "test", "test"};
    EXPECT_EQ(components, componentsEtalon);
}
